#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    long long T,n,m,L,V;
    long long v=0,b=0,s=0,sum = 0,sam = 0,sbm=0;
    long long a[100000][3],p[100000],am[100000],bm[100000];
    cin >> T;
    cin >> n >> m >> L >> V;
    for (long long i = 0;i<n;i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    for (long long i = 0;i<m;i++){
        cin >> p[i];
    }
    for (long long i = 0;i<n;i++){
        for (long long j = 0;j<m;j++){
            v = a[i][1];
            b = a[i][2];
            s = p[i] - a[i][0];
            if (s < 0){
                break;
            }
            if (v*v + 2*b*s > V){
                sum += 1;
                break;
            }
        }
    }
    for (long long i = 0;i<n;i++){
        for (long long j = 0;j<m;j++){
            v = a[i][1];
            b = a[i][2];
            s = p[i] - a[i][0];
            if (s < 0){
                break;
            }
            if (v*v + 2*b*s > V){
                am[sam] = p[i];
                sam += 1;
            }
        }
    }
    sam = 0;
    for (long long i = 0;i<n;i++){
        for (long long j = 0;j<m;j++){
            if (am[i] == bm[j]){
                sbm += 1;
            }
        }
        if (sbm == 0){
            bm[sam] = am[i];
            sam += 1;
        }
        sbm = 0;
    }
    cout << sum << " " << sam;
    fclose(stdin);
    fclose(stdout);
    return 0;
}
